//
//  ButtonView.swift
//  SwiftUIDemo
//
//  Created by Kael on 2019/11/5.
//  Copyright © 2019 Kael. All rights reserved.
//

import SwiftUI

struct ButtonView: View {
    
    @State var textName = "没选中0"
    
    @State var ktags : Bool = false

    
    var body: some View {
        
        VStack {
            Button(action: btnAction )
            {
                Image("boy")
                    .frame(width: 40, height: 40, alignment: .center)
                    .scaleEffect(0.3)
                    .clipShape(Circle())
                    .shadow(color: .red, radius: 6, x: -3, y: 3)
            }
            .background(GroupView())
            
            Spacer()
                .frame(width: 1, height: 40, alignment: .bottom)
            Text("\(textName)")
            
        }
    }
    
    
    func btnAction() -> Void {
        self.ktags = !self.ktags
        if(self.ktags){
            self.textName = "选中"
        }else{
            self.textName = "没选中"
        }
    }
    
    
    
    
}

struct ButtonView_Previews: PreviewProvider {
    static var previews: some View {
        ButtonView()
    }
}
